<template>
	<!-- <web-view src="https://www.baidu.com"></web-view> -->
	<cusHeaderVue title="我的页面" bgColor="#028BFD"></cusHeaderVue>
	<button open-type="chooseAvatar" @chooseavatar="handleAvatar">获取头像</button>
	<image :src="userAvatar" mode=""></image>
	<input type="nickname" />
	<!-- <custTabVue></custTabVue> -->
	
	
	
	<button open-type="chooseAvatar" @chooseavatar="handleAvatar">再次获取头像</button>
	<input type="nickname" />
	<view>当前语言是{{curLang}}</view>
	<button>
		{{$t('C')}}
	</button>
	<view  @click="changeLanguage">
		{{locale === 'z' ? '中文': 'English'}}
	</view>
	<view>{{$t('A')}}</view>
	<diyTabVue></diyTabVue>
</template>

<script setup>
	// import custTabVue from '../../components/cust-tab/cust-tab.vue';
	import cusHeaderVue from '../../components/cus-header/cus-header.vue';
	import diyTabVue from '../../components/diy-tab/diy-tab.vue';
import { ref } from 'vue';
import { useI18n } from 'vue-i18n';
// useI18n方法的返回值是一个对象，对象里面就有locale属性
	const {locale} = useI18n() // {locale: 'e'}
	// 想要在我的页面获取头像昵称
	const userAvatar = ref('')
	const handleAvatar = (res) => {
		console.log(res)
		userAvatar.value = res.detail.avatarUrl
	}
	
	const curLang = ref('默认语言')
	const changeLanguage = () => {
		locale.value = locale.value === 'z' ? 'e' : 'z'
		// 记住切换的语言
		uni.setStorageSync('lan', locale.value)
	}
</script>

<style>
	       
</style>
